home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 054a / setsbv.zip / SETSBVOL.C < prev    next >
C/C++ Source or Header  |  1993-03-13  |  501b  |  25 lines

  1. #include <windows.h>
  2. #include <mmsystem.h>
  3. #include <stdio.h>
  4.  
  5.  
  6. int PASCAL WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance,
  7.            LPSTR lpszcmdparam, int ncmdshow)
  8. {
  9. int   volume;
  10. BOOL  error = sscanf(lpszcmdparam, "%d", &volume) != 1;
  11. WORD  half;
  12. DWORD both;
  13.  
  14. if (!error && volume >= 0 && volume <= 255)
  15.   {
  16.   half = ((WORD) volume) * 256 + ((WORD) volume);
  17.   both = (half << 16) + half;
  18.   waveOutSetVolume(0, both);
  19.   }
  20. else
  21.   waveOutSetVolume(0, -1);
  22.  
  23. ExitProcess(0);
  24. }
  25.